﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
	<link href="js-console.css" rel="stylesheet" />
	<!-- 3. Write a script that finds the biggest of three integers
			using nested if statements. -->
</head>
<body>
	<div id="js-console"></div>
	<script src="js-console.js"></script>
	<script>
		//Read input
		var first = prompt("Enter first number");
		var second = prompt("Enter second number");
		var third = prompt("Enter third number");

		if (!isNaN(first) && !isNaN(second) && !isNaN(third)) {
			first *= 1; second *= 1; third *= 1;	// make them real number

			// Make Comparisons
			var biggestInt = 0;
			if (first > second)
			{
				if (first > third)
				{ biggestInt = first; }
				else
				{ biggestInt = third; }
			}
			else
			{
				if (second > third)
				{ biggestInt = second; }
				else
				{ biggestInt = third; }
			}

			// Write result
			jsConsole.writeLine("The biggest of three is: " + biggestInt);
		}
		else {
			jsConsole.writeLine("Wrong input.");
		}
	</script>
</body>
</html>
